$(function () {
    $.ajax({
        url: 'http://localhost:3000/api/getProductsByProductId?productId-1',
        success: function (result) {
            console.log('res:', result)
            var data = result.data
            $('.imgProduct').attr('src', ' http://localhost:3000/' + data[0].products.productPic)
            $('.productTitle').html(data[e].products.name)
            $('.productPrice').html(data[e].products.price)
            var strHTML = ''
            for (var i = 0; i < data.length; i++) {
                strHTML += `
                    <li>
                    <img src="http://localhost:3000/${data[i].users.headpic} " width="50" alt="">
                        <p class="userName">${data[i].users.name}</p>
                        <p class="commentContent">${data[i].content}</p>
                        <p class="commentTime">${data[i].commentTime}</p>
                    </li>`
            }
            $('.comments').html(strHTML)
        }
    })
})
function goCart() {
    location.href = 'goCart.html'
}
